
<template>
    <div>toRefs 将对象所有属性转换为响应式数据</div>
    <p>姓名：{{ user.name }}</p>
    <p>年龄：{{ user.age }}</p>
</template>
<script setup lang="ts">
import {toRefs,reactive} from 'vue';

const user=reactive({
    name:"刘洋",
    age:20
})
let{name,age}=toRefs(user);
setTimeout(()=>{
    name.value="刘洋+2430150241";
    age.value=22
},2000)
</script>
<style>
</style>